package com.gqz.patrol.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gqz.common.core.domain.R;
import com.gqz.common.core.domain.RequestForm;
import com.gqz.patrol.api.EnPatrolTaskOperateApi;
import com.gqz.patrol.app.service.IEnPatrolTaskOperateService;
import com.gqz.patrol.vo.EnPatrolTaskOperateVo;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EnPatrolTaskOperateController implements EnPatrolTaskOperateApi {

    @Autowired
    private IEnPatrolTaskOperateService service;

    @Override
    public R<List<EnPatrolTaskOperateVo>> getById(String id) {
        return R.ok(service.getById(id));
    }

    @Override
    public R<Page<EnPatrolTaskOperateVo>> page(@Valid RequestForm<EnPatrolTaskOperateVo> requestForm) {
        return R.ok(service.page(requestForm));
    }

    @Override
    public R<Long> count(@Valid RequestForm<EnPatrolTaskOperateVo> requestForm) {
        return R.ok(service.count(requestForm));
    }

    @Override
    public R<Integer> insert(@Valid List<EnPatrolTaskOperateVo> vos) {
        return R.ok(service.insert(vos));
    }

    @Override
    public R<Integer> update(@Valid List<EnPatrolTaskOperateVo> vos) {
        return R.ok(service.update(vos));
    }

    @Override
    public R<Boolean> delete(@Valid List<String> ids) {
        return R.ok(service.removeBatchByIds(ids));
    }

}
